﻿using System;
using System.Collections.Generic;

namespace k3cloud_webapi_sample
{
    public class K3ApiResult<T>
    {
        public T Result { get; set; }
    }
    public class BusinessInfoResult
    {
        public ResponseStatusResult ResponseStatus { get; set; }
        public NeedReturnDataResult NeedReturnData { get; set; }
    }

    public class NeedReturnDataResult
    {
        public string Id { get; set; }
        public List<LanguageTranslate> Name { get; set; }
        public string MasterPKFieldName { get; set; }
        public string PkFieldName { get; set; }
        public Type PkFieldType { get; set; }
        public List<KingdeeTable> Entrys { get; set; }
        public List<OperationsResult> Operations { get; set; }
    }

    public class OperationsResult
    {
        public int OperationId { get; set; }
        public string OperationNumber { get; set; }
        public List<LanguageTranslate> OperationName { get; set; }
    }

    public class KingdeeTable
    {

        public string Id { get; set; }
        public string Key { get; set; }
        public List<LanguageTranslate> Name { get; set; }
        public string TableName { get; set; }
        public string ParentKey { get; set; }
        public string EntryName { get; set; }
        public string EntryPkFieldName { get; set; }
        public Type PkFieldType { get; set; }
        public List<KingdeeFieldResult> Fields { get; set; }
        public string EntityType { get; set; }
        public string SeqFieldKey { get; set; }
    }

    public class KingdeeFieldResult
    {
        public string Key { get; set; }
        public List<LanguageTranslate> Name { get; set; }
        public string FieldName { get; set; }
        public string PropertyName { get; set; }
        public int FieldType { get; set; }
        public string EntityKey { get; set; }
        public string TableName { get; set; }
        public int ElementType { get; set; }
        public int MustInput { get; set; }
        public string LookUpObjectFormId { get; set; }
        public string EnumObjectId { get; set; }
        public List<ExtendsField> Extends { get; set; }
        public string ControlFieldKey { get; set; }
        public string GroupFieldTableName { get; set; }
    }

    public class ExtendsField
    {
        public string Value { get; set; }
        public string Caption { get; set; }
        public int Seq { get; set; }
        public bool Invalid { get; set; }
    }

    public class LanguageTranslate
    {
        public LanguageType Key { get; set; }
        public string Value { get; set; }

    }
    [Flags]
    public enum LanguageType : int
    {
        English = 1033,
        简体中文 = 2052,
        繁体中文 = 3076
    }

    public class ResponseStatusResult
    {
        public bool IsSuccess { get; set; }
        public List<ErrorsEntitysItem> Errors { get; set; }
        public List<SuccessEntitysItem> SuccessEntitys { get; set; }
        public List<ErrorsEntitysItem> SuccessMessages { get; set; }
        public MsgCodeType MsgCode { get; set; }
    }
    public class ErrorsEntitysItem
    {
        public string FieldName { get; set; }
        public string Message { get; set; }
        public int DIndex { get; set; }

    }
    public class SuccessEntitysItem
    {
        public int Id { get; set; }
        public string Number { get; set; }
        public int DIndex { get; set; }

    }
    public enum MsgCodeType : int
    {
        默认,
        上下文丢失,
        没有权限,
        操作标识为空,
        异常,
        单据标识为空,
        数据库操作失败,
        许可错误,
        参数错误,
        指定字段值不存在,
        未找到对应数据,
        验证失败,
        不可操作,
        网控冲突
    }
}